package com.trainoo.admin;

import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
 * @Auther: zt
 * @Date: 2019/12/16 17:44
 * @Description:
 */
@EnableDiscoveryClient
@EnableAdminServer
@SpringBootApplication
public class SpringBootAdminServer {
    /**
     * 启动时会报错如下：
     *
     * java.lang.IllegalArgumentException: Event 0 must be greater or equal to 1
     *    at org.springframework.util.Assert.isTrue(Assert.java:136) ~[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE]
     *    at de.codecentric.boot.admin.server.domain.entities.Instance.apply(Instance.java:215) ~[spring-boot-admin-server-2.1.6.jar:2.1.6]
     *    at de.codecentric.boot.admin.server.domain.entities.Instance.apply(Instance.java:209) ~[spring-boot-admin-server-2.1.6.jar:2.1.6]
     *    at de.codecentric.boot.admin.server.domain.entities.SnapshottingInstanceRepository.lambda$updateSnapshot$5(SnapshottingInstanceRepository.java:100) ~[spring-boot-admin-server-2.1.6.jar:2.1.6]
     *    at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1877) ~[na:1.8.0_171]
     *    at de.codecentric.boot.admin.server.domain.entities.SnapshottingInstanceRepository.updateSnapshot(SnapshottingInstanceRepository.java:98) ~[spring-boot-admin-server-2.1.6.jar:2.1.6]
     *
     *
     * 参考issue: https://github.com/codecentric/spring-boot-admin/issues/1231
     *
     * 据说这个错误不会有什么影响，所以2.1.x不会修复（这里使用的2.1.6版本）；2.2.0版本应该修复了这个问题
     */
    public static void main(String[] args) {
        SpringApplication.run(SpringBootAdminServer.class);
    }
}
